import { createStore, Store, useStore as useVuexStore } from 'vuex'
import login from './login/login'
import { IStoreType } from './type'
import system from './main/system/system'
import dashboard from './main/analysis/dashboard'
const store = createStore({
  state: () => {
    return {
      name: 'coderwhy'
    }
  },
  mutations: {},
  getters: {},
  actions: {},
  modules: {
    login,
    system,
    dashboard
  }
})
export function useStore(): Store<IStoreType> {
  return useVuexStore()
}
export function setupStore() {
  store.dispatch('login/loadLocalLogin')
}
export default store
